<template>
	<view class="my-search-container" :style="{'background-color':bgColor}">
		<view class="my-search-box" :style="{'border-radius':radius+'px'}" @click="sendsearchinfo">
			<uni-icons type="search" size="22" ></uni-icons>
			<text class="search-text">搜索</text>
		</view>
	</view>
</template>

<script>
	export default {
		name:"my-search",
		// 通过父组件传递过来的数据在此接收，且可直接使用
		props:{
			bgColor:{
				type:String,
				// 由于未从父组件传递数据过来，这里直接设置一个默认值即可
				default:'#c00000'
			},
			radius:{
				type:Number,
				default:25
			}
		},
		data() {
			return {
				name:'张三'
			};
		},
		methods:{
			sendsearchinfo(){
				this.$emit('myclick')
			}
		}
	}
</script>

<style lang="scss">
	.my-search-container{
		// background-color: #c00000;
		height: 50px;
		padding: 0 10px;
		display: flex;
		align-items: center;
		.my-search-box{
			height: 36px;
			background-color: #ffffff;
			width: 100%;
			// border-radius: 25px;
			display: flex;
			align-items: center;
			justify-content: center;
			
			.search-text{
				font-size: 15px
				margin-lefet 5px;
			}
		}
	}
	
</style>